<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="{{ url_for('static', filename='bootstrap/bootstrap.4.6.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/init.css') }}">
    <!-- 交给子文件自定义其他链接 -->
    {% block other_link_value %} {% endblock %}
    <title>{% block title_value %} {% endblock %}</title>
</head>

<body>
    <!-- 1.导航栏目 -->
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
        <div class="container">
            <!-- 网站标题 -->
            <a class="navbar-brand" href="{{ url_for('qa.index') }}">问答平台</a>

            <!-- 折叠按钮 -->
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>

            <!-- 折叠内容 -->
            <div class="collapse navbar-collapse" id="navbarSupportedContent">
                <ul class="navbar-nav mr-auto">
                    <li class="nav-item active"><a class="nav-link" href="{{ url_for('qa.index') }}">首页<span class="sr-only">(current)</span></a></li>

                    <li class="nav-item"><a class="nav-link" href="{{ url_for('qa.public_question') }}">发布问答</a></li>

                    <li class="nav-item ml-2">
                        <form class="form-inline my-2 my-lg-0" method="GET" action="{{ url_for('qa.search') }}">
                            <input class="form-control mr-sm-2" type="search" placeholder="关键字" aria-label="Search" name="q">
                            <button class="btn btn-outline-success my-2 my-sm-0" type="submit">搜索</button>
                        </form>
                    </li>
                </ul>

                <ul class="navbar-nav">
                    {% if user %}
                        <li class="nav-item"><span class="nav-link">{{ user.username }}</span></li>
                        <li class="nav-item"><a class="nav-link" href="{{ url_for('auth.logout') }}">退出登录</a></li>
                    {% else %}
                        <li class="nav-item"><a class="nav-link" href="{{ url_for('auth.login') }}">登录</a></li>
                        <li class="nav-item"><a class="nav-link" href="{{ url_for('auth.register') }}">注册</a></li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>

    <!-- 2.具体内容 -->
    <div class="container">{% block container_value %} {% endblock %}</div>

</body>

</html>